/*
 * @Description: 
 * @Author: admin
 * @Date: 2021-06-08 17:48:28
 * @LastEditors: admin
 * @LastEditTime: 2021-06-08 17:53:29
 */
function Animal () {
  this.name = "animal"
}
Animal.prototype = {
  sayName: function () {
    console.log(this.name);
  }
}

function Dog () {
  this.color = "black"
}
//通过将子对象的原型对象指向父对象的一个实例来完成继承

Dog.prototype = new Animal();
Dog.prototype.constructor = Dog();
Dog.prototype.sayColor = function () {
  console.log(this.color);
};

var dog = new Dog();
console.log(dog);
dog.sayColor();
dog.sayName();